﻿using System;
using System.Data.SqlClient;

namespace adonetTest01
{
    class Program
    {
        static void Main(string[] args)
        {
            string sqlconnectionString = "server=.;database=Scott;uid = sa;pwd =200274";
            SqlConnection sqlConnection = new SqlConnection(sqlconnectionString);
            sqlConnection.Open();

            var sqlcommandString = "select * from emp";

            SqlCommand sqlCommand = new SqlCommand(sqlcommandString,sqlConnection);

            var reader = sqlCommand.ExecuteReader();

            while (reader.Read())
            {
                Console.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7}",reader[0],reader[1],reader[2],reader[3],reader[4],reader[5],reader[6],reader[7]);
            }

            sqlConnection.Close();
        }
    }
}
